<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="lib/echarts.min.js"></script>
</head>
<body>
  <div style="width: 600px;height: 400px"></div>
  <script>
    var mCharts = echarts.init(document.querySelector('div'))
    var xDataArr = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
    var yDataArr = [2099, 3445, 1132, 3588, 3287, 7585, 5390, 2255, 4000, 1665, 1357, 7642]
    var yDataArr2 = [4099, 1445, 3132, 2588, 4287, 8585, 6390, 2111, 5000, 3665, 3357, 3642]
    var option = {
      xAxis: {
        type: 'category',
        data: xDataArr,
        boundaryGap: false // x轴第一个节点紧挨边缘
      },
      yAxis: {
        type: 'value',
        scale: true // 缩放：脱离0值比例
      },
      series: [
        {
          name: '康师傅',
          type: 'line',
          data: yDataArr,
          stack: 'all', // 堆叠图（在基于第一个图表的基础上累加）
          areaStyle: {}
        },
        {
          name: '统一',
          type: 'line',
          data: yDataArr2,
          stack: 'all',
          areaStyle: {}
        },
      ]
    }
    mCharts.setOption(option)
  </script>
</body>
</html>